﻿@using Microsoft.AspNet.Identity

@if (Request.IsAuthenticated)
{
    using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
    {
    @Html.AntiForgeryToken()
    <div class="pull-right">
        @{
        var manager = new UserManager<rateITcd.Models.ApplicationUser>(new Microsoft.AspNet.Identity.EntityFramework.UserStore<rateITcd.Models.ApplicationUser>(new rateITcd.Models.ApplicationDbContext()));
        var currentUser = manager.FindById(User.Identity.GetUserId());
        }


        <div class="navbar-text">@Html.ActionLink("Hello " + currentUser.UserName + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })    </div>

        <a class="btn btn-primary navbar-btn " href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
    </div>
    }
}
else
{
      @Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink", @class = "btn btn-primary navbar-btn pull-right" })
}
